package com.asia5b.a5mall.middleware.model.goods

import android.text.TextUtils
import com.asia5b.a5bmall.resource.ResString
import com.asia5b.a5mall.middleware.R
import com.asia5b.a5mall.middleware.model.base.BaseModel
import java.io.Serializable

/**
 * Created by zhangyuncai on 2020/5/13.
 */
class GoodsSelectorModel : BaseModel() {
    //分类
    var cat: ArrayList<SelectorBean>? = null

    //品牌
    var brand: ArrayList<SelectorBean>? = null

    //其他参数
    var prop: ArrayList<SelectorKeyBean>? = null
}

class SelectorKeyBean : BaseModel() {
    var key = ""
    var value: ArrayList<SelectorBean>? = null

    //后期添加的辅助字段
    var isShowDividerTop = false
    var isShowDividerBottom = false
    var selectItem: SelectorBean? = null
    var isSingleLine = false

    /**
     * 是否是品牌
     */
    fun isBrand(): Boolean {
        return TextUtils.equals(key, ResString.get(R.string.品牌))
    }

    /**
     * 是否是分类
     */
    fun isCate(): Boolean {
        return TextUtils.equals(key, ResString.get(R.string.分类))
    }
}

class SelectorBean : Serializable {
    var name = ""
    var url = ""
    var is_selected = false
    var value = ""
    var other_options = ""
}
/*
{
    "selected_cat": [
    {
        "name": "Household Products",
        "url": null,
        "is_selected": false,
        "value": "801",
        "other_options": [
            {
                "name": "testcase",
                "url": null,
                "is_selected": false,
                "value": "6428",
                "other_options": null
            },
            {
                "name": "Kitchen Supplies",
                "url": null,
                "is_selected": false,
                "value": "642",
                "other_options": null
            },
            {
                "name": "Home &amp; Living",
                "url": null,
                "is_selected": false,
                "value": "437",
                "other_options": null
            },
            {
                "name": "Stationery",
                "url": null,
                "is_selected": false,
                "value": "5834",
                "other_options": null
            },
            {
                "name": "Household Products",
                "url": null,
                "is_selected": false,
                "value": "801",
                "other_options": null
            },
            {
                "name": "Home Appliances",
                "url": null,
                "is_selected": false,
                "value": "567",
                "other_options": null
            },
            {
                "name": "Digit",
                "url": null,
                "is_selected": false,
                "value": "352",
                "other_options": null
            }
        ]
    },
    {
        "name": "Storage &amp; Organizer",
        "url": null,
        "is_selected": false,
        "value": "802",
        "other_options": [
            {
                "name": "Storage &amp; Organizer",
                "url": null,
                "is_selected": false,
                "value": "802",
                "other_options": null
            },
            {
                "name": "Bathroom Accessories",
                "url": null,
                "is_selected": false,
                "value": "803",
                "other_options": null
            },
            {
                "name": "Cleaning Tools",
                "url": null,
                "is_selected": false,
                "value": "804",
                "other_options": null
            },
            {
                "name": "Laundry &amp; Household",
                "url": null,
                "is_selected": false,
                "value": "805",
                "other_options": null
            }
        ]
    },
    {
        "name": "Balcony Storage",
        "url": null,
        "is_selected": false,
        "value": "809",
        "other_options": [
            {
                "name": "Toy Box",
                "url": null,
                "is_selected": false,
                "value": "806",
                "other_options": null
            },
            {
                "name": "Bike &amp; Sport Rack",
                "url": null,
                "is_selected": false,
                "value": "807",
                "other_options": null
            },
            {
                "name": "Desk Storage Box",
                "url": null,
                "is_selected": false,
                "value": "808",
                "other_options": null
            },
            {
                "name": "Balcony Storage",
                "url": null,
                "is_selected": false,
                "value": "809",
                "other_options": null
            },
            {
                "name": "Medicine &amp; First Aid Storage",
                "url": null,
                "is_selected": false,
                "value": "810",
                "other_options": null
            },
            {
                "name": "Shoe Organiser",
                "url": null,
                "is_selected": false,
                "value": "811",
                "other_options": null
            },
            {
                "name": "Space Saver",
                "url": null,
                "is_selected": false,
                "value": "812",
                "other_options": null
            },
            {
                "name": "Storage Bin &amp; Basket",
                "url": null,
                "is_selected": false,
                "value": "813",
                "other_options": null
            },
            {
                "name": "Wardrobe Organiser",
                "url": null,
                "is_selected": false,
                "value": "814",
                "other_options": null
            },
            {
                "name": "Travel Organizer",
                "url": null,
                "is_selected": false,
                "value": "815",
                "other_options": null
            },
            {
                "name": "Jewellery Box",
                "url": null,
                "is_selected": false,
                "value": "817",
                "other_options": null
            },
            {
                "name": "Key Box",
                "url": null,
                "is_selected": false,
                "value": "818",
                "other_options": null
            },
            {
                "name": "Storage Rack",
                "url": null,
                "is_selected": false,
                "value": "819",
                "other_options": null
            },
            {
                "name": "Other",
                "url": null,
                "is_selected": false,
                "value": "820",
                "other_options": null
            },
            {
                "name": null,
                "url": null,
                "is_selected": false,
                "value": "1160",
                "other_options": null
            }
        ]
    }
],
    "cat": [
        {
            "name": "Home &amp; Living",
            "url": null,
            "is_selected": false,
            "value": "437",
            "other_options": null
        },
        {
            "name": "Kitchen Supplies",
            "url": null,
            "is_selected": false,
            "value": "642",
            "other_options": null
        },
        {
            "name": "Household Products",
            "url": null,
            "is_selected": false,
            "value": "801",
            "other_options": null
        }
    ],
    "prop": [
        {
            "key": "材质",
            "value": [
                {
                    "name": "塑料",
                    "url": null,
                    "is_selected": false,
                    "value": "塑料",
                    "other_options": null
                },
                {
                    "name": "不锈钢304+PP",
                    "url": null,
                    "is_selected": false,
                    "value": "不锈钢304+PP",
                    "other_options": null
                },
                {
                    "name": "熟铁",
                    "url": null,
                    "is_selected": false,
                    "value": "熟铁",
                    "other_options": null
                },
                {
                    "name": "第一层: PP 无纺布, 第二层: 熔喷布,第三层: PP 无纺布",
                    "url": null,
                    "is_selected": false,
                    "value": "第一层: PP 无纺布, 第二层: 熔喷布,第三层: PP 无纺布",
                    "other_options": null
                }
            ]
        },
        {
            "key": "款式",
            "value": [
                {
                    "name": "小圆角",
                    "url": null,
                    "is_selected": false,
                    "value": "小圆角",
                    "other_options": null
                },
                {
                    "name": "挂耳式",
                    "url": null,
                    "is_selected": false,
                    "value": "挂耳式",
                    "other_options": null
                }
            ]
        },
        {
            "key": "颜色",
            "value": [
                {
                    "name": "白色",
                    "url": null,
                    "is_selected": false,
                    "value": "白色",
                    "other_options": null
                },
                {
                    "name": "北欧蓝，北欧粉，北欧绿",
                    "url": null,
                    "is_selected": false,
                    "value": "北欧蓝，北欧粉，北欧绿",
                    "other_options": null
                },
                {
                    "name": "蓝色",
                    "url": null,
                    "is_selected": false,
                    "value": "蓝色",
                    "other_options": null
                },
                {
                    "name": "蓝黄青色，蓝蓝色，红黄色，黄黄色",
                    "url": null,
                    "is_selected": false,
                    "value": "蓝黄青色，蓝蓝色，红黄色，黄黄色",
                    "other_options": null
                },
                {
                    "name": "铁色",
                    "url": null,
                    "is_selected": false,
                    "value": "铁色",
                    "other_options": null
                }
            ]
        },
        {
            "key": "个数",
            "value": [
                {
                    "name": "3片",
                    "url": null,
                    "is_selected": false,
                    "value": "3片",
                    "other_options": null
                },
                {
                    "name": "一箱 = 40 小包 （每小包50片口罩) \/ 一箱=5小包（每小包50片口罩）",
                    "url": null,
                    "is_selected": false,
                    "value": "一箱 = 40 小包 （每小包50片口罩) \/ 一箱=5小包（每小包50片口罩）",
                    "other_options": null
                }
            ]
        },
        {
            "key": "层数",
            "value": [
                {
                    "name": "三层",
                    "url": null,
                    "is_selected": false,
                    "value": "三层",
                    "other_options": null
                }
            ]
        },
        {
            "key": "形状",
            "value": [
                {
                    "name": "三角形",
                    "url": null,
                    "is_selected": false,
                    "value": "三角形",
                    "other_options": null
                },
                {
                    "name": "四方形",
                    "url": null,
                    "is_selected": false,
                    "value": "四方形",
                    "other_options": null
                }
            ]
        },
        {
            "key": "容量",
            "value": [
                {
                    "name": "2100ml",
                    "url": null,
                    "is_selected": false,
                    "value": "2100ml",
                    "other_options": null
                }
            ]
        },
        {
            "key": "有无手柄",
            "value": []
        },
        {
            "key": "规格",
            "value": [
                {
                    "name": "中号",
                    "url": null,
                    "is_selected": false,
                    "value": "中号",
                    "other_options": null
                },
                {
                    "name": "大号",
                    "url": null,
                    "is_selected": false,
                    "value": "大号",
                    "other_options": null
                }
            ]
        },
        {
            "key": "图案",
            "value": []
        },
        {
            "key": "格子数量",
            "value": []
        },
        {
            "key": "模型",
            "value": []
        },
        {
            "key": "花纹",
            "value": []
        },
        {
            "key": "配件",
            "value": []
        },
        {
            "key": "长度",
            "value": []
        },
        {
            "key": "主要成分",
            "value": []
        },
        {
            "key": "刷毛色",
            "value": []
        },
        {
            "key": "印花",
            "value": []
        },
        {
            "key": "口径",
            "value": []
        },
        {
            "key": "图纹",
            "value": []
        },
        {
            "key": "尺寸",
            "value": []
        },
        {
            "key": "手柄",
            "value": [
                {
                    "name": "有",
                    "url": null,
                    "is_selected": false,
                    "value": "有",
                    "other_options": null
                }
            ]
        },
        {
            "key": "有无锅盖",
            "value": []
        },
        {
            "key": "测量方式",
            "value": []
        },
        {
            "key": "测量时间",
            "value": []
        },
        {
            "key": "测量距离",
            "value": []
        },
        {
            "key": "温度测量范围",
            "value": []
        },
        {
            "key": "餐具",
            "value": []
        }
    ],
    "brand": []
}
 */